package com.xu.sso.web.controller;

import com.xu.sso.db.model.base.App;
import com.xu.sso.web.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private AppService appService;

    @RequestMapping("/")
    public String index(Model model) {
        List<App> list = appService.findAllStartWebApp();
        model.addAttribute("appList", list);
        model.addAttribute("appSize", (3 - list.size() % 3));
        return "index";
    }

}
